//上 --38
var K_up = false;
//下 --40
var K_down = false;
//左    --37
var K_left = false;
//右    --39
var K_right = false;
//空格  --32
var K_space = false;
//回车  --13
var K_enter = false;

document.onkeydown = function(e){
    if(e.keyCode == 40 || e.keyCode == 83)K_up=true;
    if(e.keyCode == 38 || e.keyCode == 87)K_down=true;
    if(e.keyCode == 37 || e.keyCode == 65)K_left=true;
    if(e.keyCode == 39 || e.keyCode == 68)K_right=true;
    if(e.keyCode == 32)K_space=true;
    if(e.keyCode == 13)K_enter=true;
}

document.onkeyup = function(e){
    if(e.keyCode == 40 || e.keyCode == 83)K_up=false;
    if(e.keyCode == 38 || e.keyCode == 87)K_down=false;
    if(e.keyCode == 37 || e.keyCode == 65)K_left=false;
    if(e.keyCode == 39 || e.keyCode == 68)K_right=false;
    if(e.keyCode == 32)K_space=false;
    if(e.keyCode == 13)K_enter=false;
}


